package database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Connect {

    public Connection nect= null;
    //请自行改为自己的url,user,password
    private String URL = "jdbc:mysql://localhost:3306/homework3?serverTimezone=UTC&useSSL=false";
    private String user = "root";
    private String password = "wy71774072";

    public Connect() {

    }

    public void DConnect() {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            nect = DriverManager.getConnection(URL,user,password);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            System.out.println("数据库连接失败！");
            e.printStackTrace();
        }

    }
}
